home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 1 #6 / Commodore_Disk_User_Vol.1_6_1988_-.d64 / hex_dec convert (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  227b  |  10 lines

  1. 10 input"number in hex";hx$
  2. 20 l=len(hx$)
  3. 30 if left$(hx$,1)="$"thenhx$=right$(hx$,l-1):l=l-1
  4. 40 ifl>4then 10
  5. 50 ifl<4then hx$="0"+hx$:l=l+1:goto50
  6. 60 fora=1to4:d=asc(mid$(hx$,a,1))-48
  7. 70 ifd>9thend=d-7:if d>15thenprint"number error":goto10
  8. 80 dec=dec*16+d:next
  9. 90 printdec
  10.